From 8493e199f833705eb480e91b2dd4d0328202e525 Mon Sep 17 00:00:00 2001 From: Gianni Tedesco Date: Mon, 9 Aug 2010 17:43:18 +0100 Subject: [PATCH] xc: fix segfault in pv domain create if kernel is an invalid image If libelf calls elf_err() or elf_msg() before elf_set_log() has been called then it could potentially read an uninitialised log handling callback function pointer from struct elf_binary. Fix this in libxc by zeroing the structure before calling elf_init(). Signed-off-by: Gianni Tedesco Signed-off-by: Stefano Stabellini --- tools/libxc/xc_hvm_build.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/libxc/xc_hvm_build.c b/tools/libxc/xc_hvm_build.c index 7bdd50b1f3..03e81a9e1b 100644 --- a/tools/libxc/xc_hvm_build.c +++ b/tools/libxc/xc_hvm_build.c @@ -142,6 +142,7 @@ static int setup_guest(xc_interface *xch, if ( memsize > target ) pod_mode = 1; + memset(&elf, 0, sizeof(elf)); if ( elf_init(&elf, image, image_size) != 0 ) goto error_out; elf_parse_binary(&elf); -- 2.30.2